/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import util.enumeration.ActivityType;
import util.enumeration.CuisineType;
import util.enumeration.FnbType;

/**
 *
 * @author KohLi
 */
@Entity
public class AdvertisingEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String adName; 
    private String adDesc;
    private String promotionImageUrl;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date startDate; 

    @Temporal(javax.persistence.TemporalType.DATE)
    private Date endDate; 
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date creationDate; 
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date lastEditDate; 
    
    private boolean past;
    
    @OneToMany(cascade = {CascadeType.ALL}, orphanRemoval = true, mappedBy="advertisement")
    private List<MetaCuisineEntity> cuisineTypeList = new ArrayList<MetaCuisineEntity>();
    @OneToMany(cascade = {CascadeType.ALL}, orphanRemoval = true, mappedBy="advertisement")
    private List<MetaFoodPlaceEntity> fnBTypeList = new ArrayList<MetaFoodPlaceEntity>();
    @OneToMany(cascade = {CascadeType.ALL}, orphanRemoval = true, mappedBy="advertisement")
    private List<MetaCategoryEntity> activityType = new ArrayList<MetaCategoryEntity>();
    
    
    @ManyToOne
    private StakeholderEntity stakeholder;

    
    public AdvertisingEntity() {
    }
    
    public AdvertisingEntity(AdvertisingEntity temp) {
        this(temp.getAdName(),temp.getPromotionDesc(),temp.getPromotionImageUrl(), temp.getStartDate(), temp.getEndDate());                
    }
    
    public AdvertisingEntity(String title, String details, String imgUrl, Date startDate, Date endDate){
        this.adName = title; 
        this.adDesc = details;
        this.promotionImageUrl = imgUrl;
        this.startDate = startDate;
        this.endDate = endDate;
        
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdvertisingEntity)) {
            return false;
        }
        AdvertisingEntity other = (AdvertisingEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.PromotionEntity[ id=" + id + " ]";
    }

    /**
     * @return the adName
     */
    public String getAdName() {
        return adName;
    }

    /**
     * @param adName the adName to set
     */
    public void setAdName(String promotionName) {
        this.adName = promotionName;
    }

    /**
     * @return the adDesc
     */
    public String getPromotionDesc() {
        return adDesc;
    }

    /**
     * @param adDesc the adDesc to set
     */
    public void setPromotionDesc(String promotionDesc) {
        this.adDesc = promotionDesc;
    }

    /**
     * @return the promotionImageUrl
     */
    public String getPromotionImageUrl() {
        return promotionImageUrl;
    }

    /**
     * @param promotionImageUrl the promotionImageUrl to set
     */
    public void setPromotionImageUrl(String promotionImageUrl) {
        this.promotionImageUrl = promotionImageUrl;
    }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @return the stakeholder
     */
    public StakeholderEntity getStakeholder() {
        return stakeholder;
    }

    /**
     * @param stakeholder the stakeholder to set
     */
    public void setStakeholder(StakeholderEntity stakeholder) {
        this.stakeholder = stakeholder;
    }

    /**
     * @return the creationDate
     */
    public Date getCreationDate() {
        return creationDate;
    }

    /**
     * @param creationDate the creationDate to set
     */
    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * @return the lastEditDate
     */
    public Date getLastEditDate() {
        return lastEditDate;
    }

    /**
     * @param lastEditDate the lastEditDate to set
     */
    public void setLastEditDate(Date lastEditDate) {
        this.lastEditDate = lastEditDate;
    }

    /**
     * @return the past
     */
    public boolean isPast() {
        return past;
    }

    /**
     * @param past the past to set
     */
    public void setPast(boolean past) {
        this.past = past;
    }

    /**
     * @return the cuisineTypeList
     */
    public List<MetaCuisineEntity> getCuisineTypeList() {
        return cuisineTypeList;
    }

    /**
     * @param cuisineTypeList the cuisineTypeList to set
     */
    public void setCuisineTypeList(List<MetaCuisineEntity> cuisineTypeList) {
        this.cuisineTypeList = cuisineTypeList;
    }

    /**
     * @return the fnBTypeList
     */
    public List<MetaFoodPlaceEntity> getFnBTypeList() {
        return fnBTypeList;
    }

    /**
     * @param fnBTypeList the fnBTypeList to set
     */
    public void setFnBTypeList(List<MetaFoodPlaceEntity> fnBTypeList) {
        this.fnBTypeList = fnBTypeList;
    }

    /**
     * @return the activityType
     */
    public List<MetaCategoryEntity> getActivityType() {
        return activityType;
    }

    /**
     * @param activityType the activityType to set
     */
    public void setActivityType(List<MetaCategoryEntity> activityType) {
        this.activityType = activityType;
    }

    
}
